lesia.register('lesia.Data.Set', function (l) {
	var Set = function (timeFrame) {
		/**
		 * sets timeFrame
		 */
		Object.defineProperty(this, 'timeFrame', {
			value: timeFrame
		});
		
		this._map = {};
		this._sortedTimestamps = [];
	};
	

	Set.prototype._map = null;
	
	/**
	 * consist sorted timestamps
	 * @protected
	 */
	Set.prototype._sortedTimestamps = null;
	
	/**
	 * adds item to the set
	 * @param {*} item - something what has timestamp property
	 */
	Set.prototype.addItem = function (item) {
		
		//check, does item has timestamp
		if (!item && typeof item.timestamp !== 'number') {
			throw new TypeError('Set.addItem: expects object with timestamp property');
		}
	};
	
	/**
	 * @protected
	 * @param {Number} timestamp
	 * @param {Number} index
	 */
	Set.prototype._fastInsertToSortedArray = function (timestamp, index, step) {
		if (!step) {
			//insert after index.
			this._sortedTimestamps.splice(index, 0, timestamp);
		}
		
//		var
		this._fastInsertToSortedArray(timestamp, index + (timestamp - this._sortedTimestamps[index])/this.timeFrame);
		if (timestamp < this._sortedTimestamps[index]) {
			this._fastInsertToSortedArray();
		}
	};
	
	return Set;
});